﻿Public Class frmDates
    Public pSelection As String

    Private Sub frmDates_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsDate(gDate_debut) Then
            TE_DATE_DEBUT.Value = gDate_debut
            If IsDate(gDate_fin) Then
                TE_DATE_FIN.Value = gDate_fin
            Else
                ' date de fin = date de début fin de mois
                TE_DATE_FIN.Value = TE_DATE_DEBUT.Value.AddMonths(1)
                TE_DATE_FIN.Value = TE_DATE_FIN.Value.AddDays(-1)
            End If
        Else
            ' période = mois en cours
            TE_DATE_DEBUT.Value = CDate(Now.Year.ToString & "/" & Now.Month.ToString & "/01")
            TE_DATE_FIN.Value = TE_DATE_DEBUT.Value.AddMonths(1)
            TE_DATE_FIN.Value = TE_DATE_FIN.Value.AddDays(-1)
        End If
        pSelection = ""
    End Sub

    Private Sub BO_IMPRIMER_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BO_IMPRIMER.Click
        ' imprimer Récap activités Monieurs
        gDate_debut = TE_DATE_DEBUT.Value
        gDate_fin = TE_DATE_FIN.Value
        pSelection = "du " & Format(TE_DATE_DEBUT.Value, "dd/MM/yyyy") & " au " & Format(TE_DATE_FIN.Value, "dd/MM/yyyy")
        Me.Close()

    End Sub
End Class